<div class="block">
	<div class="block-title">添加广告</div>
	<div class="block-body">
		<div class="form">
			<?php $form=$this->beginWidget('CActiveForm', array(
				'id'=>'adv-form',
				'enableAjaxValidation'=>false,
				'htmlOptions' => array(
					'enctype' => 'multipart/form-data',
				),
			)); ?>
			
				<?php echo $form->errorSummary($model); ?>
			
				<div class="row">
					<?php echo $form->labelEx($model,'网站'); ?>
					<?php echo $form->dropDownList($model, 'website_id', $this->getWebsites()); ?>
					<?php echo $form->error($model,'website_id'); ?>
				</div>
				
				<div class="row">
					<?php echo $form->hiddenField($model,'type'); ?>
				</div>
			
				<div class="row">
					<?php echo $form->labelEx($model,'广告链接'); ?>
					<?php echo $form->textField($model,'url',array('size'=>60,'maxlength'=>255)); ?>
					<?php echo $form->error($model,'url'); ?>
				</div>
				
				<div class="row">
					<label for="Adv_data_title">标题</label>
					<input type="input" name="Adv[data][title]" id="Adv_data_title" value="<?php echo $model->data['title'] ?>" size="60" />
				</div>
				
				<div class="row">
					<label>描述文字</label>
					<textarea name="Adv[data][descrip]" rows="8" cols="45"><?php echo $model->data['descrip']?></textarea>
				</div>
				
				
				<?php if ($type == 'banner'): ?>
				<div class="row">
					<?php
					if (!empty($model->data['src'])) echo "<img width='100' src='/". thumb($model->data['src']) ."' />"; 
					?>
					<label>
						<?php echo ($model->isNewRecord)? '上传图片' : '更换图片'; ?>
					</label>
					<?php echo CHtml::activeFileField($model, 'src')?>
				</div>
				<?php endif ?>
			
				<div class="row buttons">
					<?php echo CHtml::submitButton('保存'); ?>
				</div>
			
			<?php $this->endWidget(); ?>
			
			</div>
			<!-- form -->
	</div>
</div>